Kinded Parameteric Overloading
نویسندگان
چکیده
The combination of overloading and parametric polymorphism has received some attention in the functional programming community. The main approach has been that of Haskell type classes. An approach to the type-checking and semantics of parametric overloading is presented, based on using structured kinds to constrain type variables. Open kinds constrain type variables by sets of operations and are useful for the incremental development of reusable procedures (in a similar manner to Haskell classes), while closed kinds constrain type variables by sets of types (essentially providing a type-safe form of dynamic typing). The type system includes a rule for “closing up” an open kind to a closed kind. Applications of these faciities include local overloading, the combination of parametric overloading with a Standard ML-like module system, and an optimization which replaces call-site closure construction with dynamic dispatching based on explicit type tags. A set difference operation for kinds allows the unambiguous typing of overlapping overload instances. The system of kinds is provided in some detail. A type system and type inference algorithm are sketched. An operational semantics is provided and used to verify semantic soundness. This operational semantics is also used to verify the correctness of the removal of call-site closure construction.
منابع مشابه
To What Extend Is Type Inference for Parameteric Polymorphism Possible in the Presence of Ad-Hoc and Subtype Polymorphism
The aim of this paper is to compare the capabilities of type inference in different contexts. While type inference is complete in functional programming, mainstream languages still lack this feature and only slowly make progress in this area. The problems and limitations arising if subtype polymorphism and overloading, basic features in object-oriented programming, are components in such langua...
متن کاملLightweight Higher-Kinded Polymorphism
Higher-kinded polymorphism —i.e. abstraction over type constructors— is an essential component of many functional programming techniques such as monads, folds, and embedded DSLs. ML-family languages typically support a form of abstraction over type constructors using functors, but the separation between the core language and the module language leads to awkwardness as functors proliferate. We s...
متن کاملUniication of Kinded Innnite Trees
We study the problem of unifying innnite trees with variables subject to constraints on the trees they may be substituted for. The constraints are given by mappings from variables to trees, called kindings. In particular, we show that if a set of equations over a given kinding is uniiable, it has a most general uniier using only a subset of the variables in the set of equations and in the kindi...
متن کاملGeneric Programming within Dependently Typed Programming
We show how higher kinded generic programming can be represented faithfully within a dependently typed programming system. This development has been implemented using the Oleg system. The present work can be seen as evidence for our thesis that extensions of type systems can be done by programming within a dependently typed language, using data as codes for types.
متن کاملCall-graph-based Optimizations in Scala Semester Project
Scala [3] provides various high-level features that programmers can utilize in order to write readable, modular, and extensible code in a productive manner. Generics, virtual methods, higher-order functions and higher-kinded types [7] are some of these features. As one could expect, most of them come with a cost, generally in the form of an overhead in runtime performance. Take for example the ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1994